<template>
	<view class="box" v-if="info">
		<view style="background-color: #F5F7F6;height:15rpx;"></view>
		<view v-if="pages === '收到的询价'">
			<view class="cgs_info df bgcf">
				<view class="left cf tc mr15 f14">采购企业</view>
				<view class="right f1">
					<view class="f13" style="color: black;">{{ info.userInfo.company }}</view>
					<view class="df ac mt5">
						<p class="f13 w80" style="color: gray;">联系人：</p>
						<p class="f13 c28" style="color: black;">{{ info.userInfo.username }}</p>
					</view>
					<view class="df ac mt5">
						<p class="f13 w80" style="color: gray;">手机号：</p>
						<p class="f13" style="color: black;">{{ info.userInfo.company_tel}}</p>
						<P v-if="!info.userInfo.company_tel.includes('*')" class="cop-but ml30"
							@tap.stop="copyText($event, { text: info.userInfo.company_tel })">复制</P>
					</view>
					<view v-if="info.userInfo.email" class="df ac mt5">
						<p class="f13 w80 weixin_img" style="color: gray;">
							<image src="https://cdn.xtwaixie.com/uploads/20250210/173915182467a959d064f28.png"></image>：
						</p>
						<p class="f13" style="color: black;">{{ info.userInfo.email}}</p>
						<P v-if="!info.userInfo.email.includes('*')" class="cop-but ml30"
							@tap.stop="copyText($event, { text: info.userInfo.email })">复制</P>
					</view>
				</view>
			</view>
			<view class="bgcf f13" style="padding:0rpx 20rpx;color: gray;">
				<!-- 报价方式：
				{{ quote_type === 0 ? '直接联系' : '先加微信' }}	 -->
				报价方式：
				<!-- 禁用的单选按钮，展示选择但无法更改 -->
				<radio-group>
					<radio value="0" :checked="!quote_type" :disabled="true" /> 直接联系
					<radio value="1" :checked="quote_type" :disabled="true" /> 先加微信
				</radio-group>
			</view>
			<view class="df mb10 mt10" style="padding: 0rpx 20rpx;">
				<view v-if="info.userInfo.drawing.length != 0 || info.userInfo.file.length != 0" class="mr10 f13"
					style="width: 170rpx;color: gray;white-space: nowrap;">
					采购商资料：
				</view>
				<view class="f1">
					<ul class="df ac fw" v-if="info.userInfo.drawing.length != 0">
						<block v-for="(it, index) in info.userInfo.drawing" :key="index">
							<li class="mb8 mr8 img64 pr db" @click="preview('cgs',index)">
								<image class="img64" referrerPolicy='no-referrer' :src="getImgSrc(it)"
									mode="aspectFill" />
							</li>
						</block>
					</ul>
					<view class="h44 mt8 bgcf7 df ac pd015" v-if="info.userInfo.file.length != 0"
						v-for="(it, index) in info.userInfo.file" :key="index">
						<image class="img16" src="https://wx.xtwaixie.com/img/file.png"></image>
						<view class="ml8 f14 c28 f1 cgs_file_css">
							{{ !is_vip && pages === '收到的询价' ? '***********.'+getFileExtension(it.name):it.name }}
						</view>
						<view class="f12 c10" style="width:100rpx;" @tap.native="onLooks($event, { i: index })"
							:data-i="index">在线预览</view>
					</view>
				</view>
			</view>

			<view class="pd10" v-if="!is_vip">
				<view class="email df ac sb ">
					<!-- <view class="f1">
						<p class="f14 cff8 f500 db">免费报价剩余次数：{{ user_info.free_number }}次</p>
					</view> -->
					<view class="f1">
						<p class="f14 cff8 f500 db" style="width: 510rpx;">升级至尊VIP会员即可联系采购商</p>
					</view>
					<button class="email-but f12"
						style="height: auto;line-height: 1;width: 140rpx !important;border-radius: 200rpx;padding: 10rpx 0;"
						@click="goPage('/pages/recharge/recharge')">
						<view class="f13">
							立即升级
						</view>
					</button>
				</view>
			</view>
		</view>
		<view v-else>
			<!-- <view class="cgs_info df">
				<view class="left cf tc mr10">
					供应商
				</view>
			</view>
			<view class="df ac" style="padding:0rpx 20rpx;">
				<view class="right f1" style="width:65%">
					<view class="f16">
						{{ info.userInfo.company }}
					</view>
				</view>
				<view class="f13" style="width:25%;margin-left:10%">
					<view class="look_info cf" @click="goPage('/subPack/factoryDetails/factoryDetails',info.uid)">查看企业信息</view>
				</view>
			</view> -->

			<!-- 工厂展示 -->
			<FactoryInfo :list="settled_list" :isIndex="false" />

			<!-- 分割线 -->
			<div class="divider-wrapper">
				<div class="divider"></div>
			</div>

			<!-- 判断是否是vip -->
			<!-- <view class="pd10" v-if="!is_vip">
				<view class="email df ac sb mt15"> -->
			<!-- <view class="f1">
						<p class="f14 cff8 f500 db">免费报价剩余次数：{{ user_info.free_number }}次</p>
					</view> -->
			<!-- <view class="f1" >
						<p class="f14 cff8 f500 db" style="width: 510rpx;">升级至尊VIP会员即可联系采购商</p>
					</view>
					<button class="email-but f12"
						style="height: auto;line-height: 1;width: 140rpx !important;border-radius: 200rpx;padding: 10rpx 0;"
						@click="goPage('/pages/recharge/recharge')">
						<view class="f13">
							立即升级
						</view>
					</button>
				</view>
			</view> -->
		</view>
		<view style="background-color: #F5F7F6;height:10rpx;" v-if="pages === '收到的询价'"></view>
		<!-- <view class="df ac" style="padding: 0rpx 20rpx;">
			<view class="mr10" style="width: 155rpx;">询价来自</view>
			<view class="product_from f13">
				产品
			</view>
		</view> -->
		<view class="bgcf mt20" style="padding: 20rpx;">
			<view class="spare_parts_name f13" style="color: gray;">
				需求说明：
			</view>

			<view class="spare_parts_name mt10 f13" style="padding:0rpx 20rpx;">
				{{ info.spare_parts_name }}
			</view>
		</view>
		<!-- 分割线 -->
		<div class="divider-wrapper">
			<div class="divider"></div>
		</div>

		<view class="bgcf" style="padding: 20rpx;" v-if="info.drawing.length != 0 || info.file.length != 0">

			<view class="name mb10 f13" style="color: gray;">
				附件：

			</view>

			<view class="spare_parts_name mt10" v-if="info.drawing.length != 0">
				<block v-for="(item, index) in info.drawing" :key="index">
					<image class="img90 mr8 mt8" referrerPolicy='no-referrer' :src="item"
						@tap.stop.prevent="preview2(index)" :data-src="item"></image>
				</block>
			</view>
			<view v-if="info.file.length != 0">
				<view class="fileBox df ac" v-for="(item, index) in info.file" :key="index">
					<view class="fileNum" style="padding:0rpx 20rpx 0rpx 0rpx;">
						{{index + 1}}
					</view>
					<view class="file-box df ac sb">
						<image class="img16" src="https://wx.xtwaixie.com/img/file.png"></image>
						<p class="f14 c28 ml8 w224 ovh">{{ item.name }}</p>
						<p v-if="changeMp4(item.url)" class="f12 c10" :data-i="index">
							<view v-for="(items, index) in [file]">
								<p @click="videoMp(items.url)">在线预览</p>
							</view>
						</p>
						<p class="f12 c10" @tap.native="onLook($event, { i: index })" :data-i="index"
							v-else-if="changeBtn(item.url)">在线预览</p>
						<p class="f12 c10" @tap.native="onLook($event, { i: index })" :data-i="index" v-else>转发好友</p>
						<p class="f12 c10" style="opacity: 0;" v-else>在线预览</p>
					</view>
				</view>
			</view>
			<view class="bgcf">




				<view class="fileTips" v-if="isPc">

					<view class="tipTitle"> 复制文件链接，下载至电脑查看 </view>
					<view class="df">
						<!-- <view class="tipBtn" @tap="forward()"> 转发 </view> -->
						<view class="tipBtn" @tap="copy"> 复制链接 </view>
					</view>
					<view class="tipContent"> 1.点击【复制链接】 </view>
					<view class="tipContent" style="margin-bottom: 20rpx;"> 2.在电脑端浏览器，粘贴链接即可下载 </view>
					<view class="tips" @click="lookMore()"> 查看详细步骤 </view>
				</view>
				<view v-else class="df" style="flex-direction: column;align-items: center;margin-top: 40rpx">
					<view class="tipBtn" @tap="sliderVerifyFLag = true">全部下载</view>
				</view>
			</view>
		</view>

		<view class="pd20 mt15" hover-class="none" :hover-stop-propagation="false">
			<button class="sub" style="background-color: red;height: 100rpx;line-height: 100rpx;border-radius: 50rpx;"
				@tap="onSub">
				{{ pages === '收到的询价' ? '联系采购商' : '联系供应商' }}
			</button>
		</view>

		<slider-verify :isShow="sliderVerifyFLag" @touchSliderResult="verifyResult" ref="verifyElement"></slider-verify>
		<view class="previewBox" @tap="mpVid()" v-if="videoS">
			<swiper :indicator-dots="true" indicator-active-color='#FFF' indicator-color='rgba(255,255,255,0.3)'
				:duration="1000" style="width: 100%;height: 100vh;">
				<swiper-item v-for="(item, index) in mp" :key="index">
					<view style="height: 100vh;display: flex;align-items: center;">
						<video @click.stop="videoS=true" :src='item'></video>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<van-popup :show="show" round>
			<p class="db pd200 mt5 w311">
				<span class="f16 c28 f500 db tc">确定下载？</span>
			</p>
			<view class="df ac btf1 h48">
				<p class="w50 tc f16 c28" @tap.native="show = false">取消</p>
				<button class="share-but1 h48 c10" @tap="forward">确定</button>
			</view>
		</van-popup>
		<!-- <van-popup :show="true" round @close="showVip = false" :custom-style="{background:'none'}">
			<view>
				<image style="width: 600rpx;" :src="getImgSrc('/uploads/20241223/17349245686768d918bd269.png')" mode="widthFix"></image>
			</view>
		</van-popup> -->
		<van-popup :show="showVip" z-index='10000' :close-on-click-overlay='true'
			custom-style='background:rgba(0,0,0,0);' @click-overlay="close">
			<view class="popupBox">
				<image referrerPolicy='no-referrer' :src="getImgSrc('/uploads/20241223/17349245686768d918bd269.png')"
					mode="widthFix" class="popupImg" @click="goPage('/pages/recharge/recharge')"
					style="width: 610rpx;max-height:250rpx"></image>
			</view>
		</van-popup>

		<van-popup :show="ifStatus" round @close="ifStatus = false">
			<p class="df ac jc pd200 mt5 w311">
				<span class="f16 c28 f500">您的详细资料{{ my_info.status == 1 ? '正在审核中' : '未通过审核' }}。</span>
			</p>
			<p class='df ac jc btf1 f16 c10 h48' @tap="ifStatus = false">我知道了</p>
		</van-popup>
	</view>
</template>

<script>
	import http from '../../utils/http';
	import sliderVerify from '@/component/slider-verify.vue'; //组件存放的路径
	import FactoryInfo from '@/component/factory'
	export default {
		components: {
			sliderVerify,
			FactoryInfo
		},
		data() {
			return {
				id: 0,
				ifStatus: false,
				img: [],
				name: [],
				videoS: false,
				mp: "",
				sliderVerifyFLag: false,
				isPc: false,
				info: null,
				index: 0,
				loading: false,
				pages: '收到的询价',
				my_info: null,
				is_vip: false,
				showVip: false,
				quote_type: 0,
				settled_list: [],
				add_id: 0,
				show: false,
				// file:[],
			}
		},
		onLoad(opt) {
			this.id = opt.id
			uni.setStorageSync("platform", uni.getSystemInfoSync().platform);
			if (["windows", "mac"].some((v) => v == uni.getStorageSync("platform"))) {
				this.isPc = true
			}
			if (opt.pages) {
				this.pages = opt.pages
			}
			if (this.pages == '收到的询价') {
				uni.setNavigationBarTitle({
					title: '采购详情'
				});
			}

			this.getInfo()

			// console.log(this.is_vip,111)
		},
		methods: {
			getInfo() {
				http.request('demand/addInfo', {
					id: this.id
				}).then(res => {
					this.info = res.data


					this.info.userInfo = this.info.userInfo || {};

					this.info.drawing = this.toParse(this.info.drawing).map(item => this.getImgSrc(item))
					this.info.file = this.toParse(this.info.file)
					this.quote_type = this.info.quote_type
					this.info.userInfo.drawing = this.toParse(this.info.userInfo.drawing)
					this.info.userInfo.file = this.toParse(this.info.userInfo.file)
					this.add_id = this.info.user_settled_id



					// 工厂展示
					const latitude = uni.getStorageSync('latitude')
					const longitude = uni.getStorageSync('longitude')
					http.request('user_settled/list', {
						id: this.add_id,
						// id:20355,
						my_longitude: longitude,
						my_latitude: latitude

					}).then(res => {
						this.settled_list = res.data.data
						this.settled_list.forEach(item => {
							item.machining = item.machining.join('、')
							item.service_industry = item.service_industry.join('、')
							item.machining_products.forEach(el => {
								if (el.url.startsWith('[')) {
									try {
										el.url = JSON.parse(el.url);
									} catch (e) {
										el.url = null;
									}
								}
							});
						})

					})


				})

				http.request('user/settledInfo').then(res => {
					this.my_info = res.data.info
					const {
						grade,
						grade_type
					} = res.data.info.userInfo
					console.log(grade, grade_type)
					// this.is_vip = grade > 0
					this.is_vip = grade == 2 && grade_type == 1 && this.pages == '收到的询价'
				})




			},
			toParse(info) {
				const data = JSON.parse(info) || []
				return data
			},
			mpVid() {
				this.videoS = false
			},
			verifyResult(res) {
				this.sliderVerifyFLag = false;
				if (res) { //校验通过
					this.show = true
				}
			},
			changeBtn(item) {
				let typeList = ['doc', 'xls', 'ppt', 'pdf', 'PDF', 'docx', 'xlsx', 'pptx']
				let result = false
				typeList.forEach((res) => {

					let isObj = typeof item === 'object' ? true : false
					let file_type = isObj ? item['url'] : item

					if (file_type.split('.')[file_type.split('.').length - 1] == res) {
						result = true
					}
				})

				// typeList.forEach((res) => {
				// 	let{name,url}=item
				// 	if (url.split('.')[url.split('.').length - 1] == res) {
				// 		result = true
				// 	}
				// })
				return result
			},
			copyText(e, _dataset) {
				/* ---处理dataset begin--- */
				this.handleDataset(e, _dataset);
				/* ---处理dataset end--- */
				let text = e.currentTarget.dataset.text;
				uni.setClipboardData({
					data: text,
					success(res) {
						uni.getClipboardData({
							success(res) {
								uni.showToast({
									title: '复制成功',
									icon: 'none'
								});
							}
						});
					}
				});
			},
			onLooks(e, _dataset) {
				// 判断供应商是至尊vip
				if (!this.is_vip && this.pages == '收到的询价') {
					this.showVip = true
					return false
				}

				if (this.my_info.status !== 2) {
					this.ifStatus = true
					return
				}
				if (this.loading) {
					return
				}
				this.loading = true
				setTimeout(() => {
					this.loading = false
				}, 1000);
				/* ---处理dataset begin--- */
				this.handleDataset(e, _dataset);

				/* ---处理dataset end--- */
				let i = e.currentTarget.dataset.i;
				const url = this.info.userInfo.file[i].url
				const file = this.info.userInfo.file[i]
				// const urls = url
				const status = this.changeBtn(url)
				const extension = this.getFileExtension(url);

				const randfile = file.name.endsWith('.' + extension) ? file.name : file.name + '.' + extension

				const newPath = `${wx.env.USER_DATA_PATH}/${randfile}`;
				console.log(newPath)
				let showMenu = this.info.userInfo.grade == 2;
				uni.showLoading({
					title: '文件下载中'
				});

				console.log(this.getImgSrc(url), '11', newPath)

				uni.downloadFile({
					url: this.getImgSrc(url),
					filePath: newPath,
					success(res) {
						console.log(res);
						if (res.statusCode === 200) {
							if (status) {
								uni.openDocument({
									filePath: res.filePath || res.tempFilePath,
									showMenu: showMenu,
									success(res) {
										// console.log(res);
										console.log('打开/文档成功');
										uni.hideLoading();
									},
									fail(res) {
										console.log(res);
										uni.hideLoading();
									}
								});
							} else {
								uni.shareFileMessage({
									filePath: res.filePath || res.tempFilePath,
									success(res) {
										// console.log(res);
										uni.hideLoading();
									},
									fail(res) {
										console.log(res);
										uni.hideLoading();
									}
								});
							}
						} else {
							uni.hideLoading();
						}
					},
					fail(res) {
						console.log(res);
						uni.hideLoading();
					}
				});
			},
			onLook(e, _dataset) {

				if (this.my_info.status !== 2) {
					this.ifStatus = true
					return
				}
				if (this.loading) {
					return
				}


				this.loading = true
				setTimeout(() => {
					this.loading = false
				}, 1000);
				/* ---处理dataset begin--- */
				this.handleDataset(e, _dataset);

				/* ---处理dataset end--- */
				// const baseUrl = "https://cdn.xtwaixie.com"
				let i = e.currentTarget.dataset.i;


				// let url = typeof this.info.file[i] === 'object' ? this.info.file[i]['url'] : this.info.file[i];
				let url = this.info.file[i].url;
				console.log(url)

				const status = this.changeBtn(url)
				const extension = this.getFileExtension(url);

				const randfile = url.endsWith('.' + extension) ? url : url + '.' + extension
				const newTempPath = randfile.replace(/\//g, '-')
				const newPath = `${wx.env.USER_DATA_PATH}/${newTempPath}`;
				// console.log(wx.env.USER_DATA_PATH)

				console.log(randfile, 'randfile')
				console.log(newPath, 'newPath')

				let showMenu = this.info.userInfo.grade == 2;

				uni.showLoading({
					title: '文件下载中'
				});



				uni.downloadFile({
					url: this.getImgSrc(url),
					filePath: newPath,
					success(res) {
						console.log(res, '222');
						if (res.statusCode === 200) {
							if (status) {
								uni.openDocument({
									filePath: res.filePath || res.tempFilePath,
									showMenu: showMenu,
									success(res) {
										// console.log(res);
										console.log('打开/文档成功');
										uni.hideLoading();
									},
									fail(res) {
										console.log(res);
										uni.hideLoading();
									}
								});
							} else {
								uni.shareFileMessage({
									filePath: res.filePath || res.tempFilePath,
									success(res) {
										// console.log(res);
										uni.hideLoading();
									},
									fail(res) {
										console.log(res);
										uni.hideLoading();
									}
								});
							}
						} else {
							uni.hideLoading();
						}
					},
					fail(res) {
						console.log(res);
						uni.hideLoading();
					}
				});
			},
			getFileExtension(filePath) {
				let isObj = typeof filePath === 'object' ? true : false
				let fileUrl = isObj ? filePath['url'] : filePath
				// 使用最后一个点和文件名的分隔符来获取文件名
				const filename = fileUrl.split('/').pop();
				// 获取文件名中的后缀部分
				const extension = filename.split('.').pop();
				return extension;
			},
			lookMore() {
				uni.navigateTo({
					url: '/subPack/step/step'
				})
			},
			preview(type, index) {
				// console.log(info.)

				if (!this.is_vip && this.pages === '收到的询价') {
					this.showVip = true
					return false
				}

				let urls = []
				if (type === 'cgs') {
					urls = this.info.userInfo.drawing.map(item => {
						return this.getImgSrc(item)
					})
				} else {
					urls = this.info.drawing.map(item => {
						return this.getImgSrc(item)
					})
				}
				console.log(urls)
				uni.previewImage({
					current: index,
					urls: urls
				});
			},
			preview2(type, index) {
				// console.log(info.)

				let urls = []
				if (type === 'cgs') {
					urls = this.info.userInfo.drawing.map(item => {
						return this.getImgSrc(item)
					})
				} else {
					urls = this.info.drawing.map(item => {
						return this.getImgSrc(item)
					})
				}
				console.log(urls)
				uni.previewImage({
					current: index,
					urls: urls
				});
			},
			copy() {
				http.request('demand/getIp', {
					type: 1,
					id: this.id,
				}).then((res) => {
					let text = http.url +
						`/h5/?#/?decrypt=${this.info.decrypt}${this.index == 1 ? '&index=1':''}&decrypt_time=${this.info.decrypt_time}`
					uni.setClipboardData({
						data: text,
						success(res) {
							uni.showToast({
								title: '复制成功',
								icon: 'none'
							});
						},
						fail(err) {
							console.log(err);
						}
					});
				}).catch((res) => {
					console.log(res);
				});
			},
			onSub() {

				console.log(this.pages)
				console.log(this.is_vip)

				if (!this.is_vip && this.pages === '收到的询价') {
					this.showVip = true
					return
				}
				if (this.my_info.status !== 2) {
					this.ifStatus = true
					return
				}
				if (this.pages === '我的询价') {
					uni.makePhoneCall({
						// phoneNumber: this.info.userInfo.company_tel,
						phoneNumber: this.info.user_settled.mobile,
						success(res) {

						}
					});
				} else {
					uni.makePhoneCall({
						phoneNumber: this.info.userInfo.company_tel,
						success(res) {

						}
					});
				}

			},
			goPage(url, id) {
				uni.navigateTo({
					url: id ? url + '?id=' + id : url,
				})
			},
			copylink() {
				uni.setClipboardData({
					data: 'https://www.666xpkj.com/',
					success: function() {
						return uni.showToast({
							icon: "none",
							title: '复制链接成功，去分享给你的好友吧!',
						});
					}
				});
			},
			videoMp(Mp) {
				console.log(Mp)
				let typeList = ['mp4']
				this.mp = Mp.filter(item => item.includes(typeList))
				console.log(this.mp)
				this.videoS = true
			},
			changeMp4(item) {

				let typeList = ['mp4']
				let result = false
				typeList.forEach((res) => {
					// let{name,url}=item
					if (item.split('.')[item.split('.').length - 1] == res) {
						result = true
					}
				})
				return result
			},
			close() {
				this.showVip = false
				// 关闭逻辑，返回上一步操作
				// uni.navigateBack();
			},
			// 获取文件后缀名
			getFileExtension(filename) {
				const lastDotIndex = filename.lastIndexOf('.');
				if (lastDotIndex === -1) {
					// 如果没有找到 .，返回空字符串或提示无后缀
					return '';
				}
				return filename.substring(lastDotIndex + 1);
			},
			// 文件下载
			forward() {

				if (this.loading) {
					return
				}
				this.show = false
				this.loading = true
				uni.showLoading({
					title: '文件下载中'
				});

				let file_new = []

				setTimeout(() => {
					this.loading = false
				}, 1000);
				this.file = this.info.file
				this.name = this.info.file.name
				this.img = this.info.drawing
				// console.log(this.img)
				console.log(this.name)

				// console.log(this.file.length)
				// console.log(this.img.length)
				if (this.file.length + this.img.length === 1) {
					let url = '';
					let filePath = ''
					if (this.file.length > 0) {
						url = this.file[0].url
						filePath =url.substring(url.lastIndexOf('/'))
					} else {
						url = this.img[0]
					}
					url = this.getImgSrc(url)

					uni.downloadFile({
						url,
						success(res) {
							if (res.statusCode === 200) {
								console.log(res)
								uni.shareFileMessage({
									filePath: res.filePath || res.tempFilePath,
									success(res1) {
										uni.hideLoading();
									},
									fail(err) {
										console.log(err)
										uni.showToast({
											title: '分享失败1',
											icon: 'none'
										});
										uni.hideLoading();
									}
								});
							} else {
								console.log(res)
								uni.showToast({
									title: '分享失败2',
									icon: 'none'
								});
								uni.hideLoading();
							}
						},
						fail(res) {
							console.log(res)
							uni.showToast({
								title: '分享失败3',
								icon: 'none'
							});
							uni.hideLoading();
						}
					})
					return
				}
				
				let names = this.file.map(item => item.name)
				let urls = this.file.map(item => this.getImgSrc(item.url))
				console.log(names)
				console.log(urls)
				http.request('demand/getIp', {
					type: 1,
					id: this.id,
					name: this.lj_name,
					file: urls || [],
					fileName: names || [],
					img: this.img || [],
				}).then((res) => {
					const url = res.data.url

					uni.downloadFile({
						url: http.url + url,
						filePath: wx.env.USER_DATA_PATH + url.substring(url.lastIndexOf('/')),
						success(res) {
							if (res.statusCode === 200) {
								wx.shareFileMessage({
									filePath: res.filePath || res.tempFilePath,
									success(res) {
										console.log(res);
										http.request('demand/unlink', {
											url
										})
										uni.hideLoading();
									},
									fail(res) {
										console.log(res);
										http.request('demand/unlink', {
											url
										})
										uni.showToast({
											title: '分享失败4',
											icon: 'none'
										});
										uni.hideLoading();
									}
								});
							} else {
								http.request('demand/unlink', {
									url
								})
								uni.showToast({
									title: '分享失败5',
									icon: 'none'
								});
								uni.hideLoading();
							}
						},
						fail(res) {
							console.log(res)
							http.request('demand/unlink', {
								url
							})
							uni.showToast({
								title: '分享失败6',
								icon: 'none'
							});
							uni.hideLoading();
						}
					})
				}).catch((res) => {
					console.log(res);
					uni.hideLoading();
				});
			},



		}
	}
</script>

<style lang="scss">
	.popupBox {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.popupImg {
		width: 550rpx;
	}

	.email {
		width: 100%;
		background: #fff9ef;
		border-radius: 8rpx;
		padding: 18rpx 24rpx;
		box-sizing: border-box;
	}

	.email-but {
		width: 178rpx !important;
		height: 72rpx;
		background: #ff8000;
		border-radius: 36rpx;
		padding: 0;
		line-height: 72rpx;
		margin: 0 !important;
		font-size: 28rpx;
		font-family: PingFangSC, PingFangSC-Regular;
		font-weight: 400;
		text-align: center;
		color: #ffffff;
	}

	.product_from {
		background-color: #F1F1F2;
		width: 300rpx;
		padding: 8rpx 0rpx 8rpx 20rpx;
		border-radius: 14rpx;
	}

	// page{
	// 	background-color: #F5F7F6;
	// }
	.look_info {
		padding: 5rpx 15rpx;
		border-radius: 14rpx;
		background-color: $xt-primary;
	}

	.previewBox {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		background-color: rgba(0, 0, 0, 0.9);
	}

	.fileTips {
		padding: 20rpx 0;
		margin-top: 20rpx;
		background-color: #f7f8fc;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.tipTitle {
		color: #283043;
		font-size: 28rpx;
		margin-bottom: 20rpx;
	}

	.tipContent {
		color: #9DA3B0;
		font-size: 24rpx;
	}

	.tipBtn {
		background-color: #68BF7B;
		width: 300rpx;
		border-radius: 16rpx;
		font-size: 28rpx;
		color: #FFF;
		text-align: center;
		line-height: 70rpx;
		font-weight: bold;
		margin: 0 20rpx 20rpx;
	}

	.tips {
		color: #1050c7;
		font-size: 24rpx;
		text-decoration: underline;
	}

	.box {
		// padding: 20rpx;

	}

	.cgs_info {
		padding: 20rpx;

		.left {
			width: 150rpx;
			box-sizing: border-box;
			// padding: 6rpx 10rpx;
			max-height: 45rpx;
			line-height: 45rpx;
			border-radius: 8rpx;
			background-color: #0239BA;
		}

		.right {}
	}

	radio-group {
		display: inline-block;
	}

	radio {
		transform: scale(0.7);
		margin-left: 5px;
		/* 调整按钮间的间距 */
	}

	.divider-wrapper {
		padding-left: 10px;
		/* 左侧间距 10px */
		padding-right: 10px;
		/* 右侧间距 10px */
	}

	.divider {
		width: 100%;
		/* 分割线占满父容器的宽度 */
		height: 1px;
		/* 分割线的高度 */
		background-color: #f0f0f0;
		/* 浅灰色 */
		margin: 20px 0;
		/* 上下间距，可以根据需要调整 */
	}

	.cgs_file_css {
		width: 340rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.share-but1 {
		width: 50% !important;
		font-size: 32rpx;
		padding: 0 !important;
		margin: 0 !important;
		font-weight: 400;
		text-align: center;
		color: #283043;
		line-height: 96rpx;
		border-left: 1rpx solid #ebedf0;
	}

	.weixin_img {
		width: 80rpx;
		height: 28rpx;
		display: flex;
		line-height: 28rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>